class cintFIFO {
  cintFIFO() {
    list = new IntList();
  }

  void in(int val) {
    list.append(val);
  }

  int out() {
    int ret = -2147483648; // max negative number
    if (list.size() > 0) {
      ret = list.get(0);
      list.remove(0);
    }
    return ret;
  }

  int size() {
    return list.size();
  }

  void clear() {
    list.clear();
  }

  boolean isEmpty() {
    return (list.size() == 0);
  }

  boolean isNotEmpty() {
    return (list.size() != 0);
  }

  // as a FIFO, usually get, set, reverse are not used
  int get(int pos) {
    int val = -2147483648; // max negative number
    if (pos >= list.size()) {
      return val;
    }
    return list.get(pos);
  }

  void set(int pos, int val) {
    list.set(pos, val);
  }

  void reverse() {
    list.reverse();
  }

  private IntList list;
};
